package main

import "fmt"

type sto struct {
	name  string
	zhnas int
	prer  int
}

func mainmap() {
	//把map中的v值改为结构体
	m := make(map[int]sto)
	m[1] = sto{}
	m[2] = sto{"heer", 10, 20}
	m[3] = sto{"heer", 10, 20}
	m[4] = sto{"heer", 10, 20}
	m[5] = sto{"heer", 10, 20}
	fmt.Println(m)
}
func main() {
	//结构体切片
	m := make(map[int][]sto)
	m[0] = []sto{{"heer", 10, 20}}
	m[1] = []sto{{"heer", 11, 21}}
	m[2] = []sto{{"heer", 12, 22}}
	fmt.Println(m)
	//添加数据
	m[3] = append(m[3], sto{"heer", 13, 23})
	fmt.Println(m)

}
